package com.example.administrator.waitan.find.news.food;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.example.administrator.waitan.R;
import com.example.administrator.waitan.base.BaseActivity;

/**
 * Created by Administrator on 2016/1/18.
 */
public class SweetContentActivity extends BaseActivity {
    private WebView sweetWebView;
    private String url = "http://www.hongniujia.com/zhuti/remai/";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sweetcontent);
        sweetWebView = (WebView) findViewById(R.id.webView_item_sweetContent);
        findViewById(R.id.img_sweetContent_return).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        Intent receiveSweet = getIntent();
        String sweetId = receiveSweet.getStringExtra("sweetId");
        String sweetType = receiveSweet.getStringExtra("sweetType");
        String sweetUrl = url + sweetId + "A" + sweetType;
        Log.d("sweetUrl", sweetUrl);
        sweetWebView.getSettings().setJavaScriptEnabled(true);
        sweetWebView.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                view.loadUrl(url);
                return true;
            }
        });
        sweetWebView.setWebChromeClient(new WebChromeClient() {
        });
       sweetWebView.loadUrl(sweetUrl);
    }
}
